import mockApi from "@/api/mockApi";

export default class candidateApi {
  static candidates = [
    {"id":1,"username":"wangqiang","name":"王强","password":"wangqiang789","gender":1,"birthDate":"1988-05-28","contactPhone":"13712345678","email":"wangqiang@bluesky-env.com","province": "31", "provinceName": "上海市", "city": "3101", "cityName": "上海市", "area": "310115", "areaName": "浦东新区","address":"张江高科技园区456号","createTime":"2024-01-20 22:24:09","modifyTime":"2024-08-10 22:24:09"},
    {"id":2,"username":"chenjing1","name":"陈静","password":"chenjing123","gender":2,"birthDate":"1991-05-01","contactPhone":"13687654321","email":"chenjing@bluesky-env.com","province": "31", "provinceName": "上海市", "city": "3101", "cityName": "上海市", "area": "310115", "areaName": "浦东新区","address":"张江高科技园区789号","createTime":"2024-08-25 22:24:09","modifyTime":"2024-12-31 22:24:09"},
    {"id":3,"username":"zhangwei1","name":"张伟","password":"zhangwei123","gender":1,"birthDate":"1990-06-23","contactPhone":"13812345678","email":"zhangwei@greenfarm.com","province": "44", "provinceName": "广东省", "city": "4403", "cityName": "深圳市", "area": "440305", "areaName": "南山区", "address": "科技园南区1号","createTime":"2024-10-24 22:24:09","modifyTime":"2024-06-25 22:24:09"},
    {"id":4,"username":"linana123","name":"李娜","password":"lina456","gender":2,"birthDate":"1992-02-14","contactPhone":"13987654321","email":"lina@sunshine-tech.com","province": "11", "provinceName": "北京市", "city": "1101", "cityName": "北京市", "area": "110108", "areaName": "海淀区","address":"中关村大街1号","createTime":"2024-08-10 22:24:09","modifyTime":"2024-10-05 22:24:09"},
    {"id":5,"username":"liuyang","name":"刘洋","password":"liuyang456","gender":1,"birthDate":"1989-02-26","contactPhone":"13512345678","email":"liuyang@bluesky-env.com","province": "31", "provinceName": "上海市", "city": "3101", "cityName": "上海市", "area": "310115", "areaName": "浦东新区","address":"张江高科技园区101号","createTime":"2024-06-08 22:24:09","modifyTime":"2024-05-13 22:24:09"}
  ]

  static async save (params) {
    console.log('candidateApi save params', params)
    const response = await mockApi.operateSuccessfully()
    return response.data
  }

  static async find (params) {
    console.log('candidateApi find params', params)
    const response = await mockApi.queryPageSuccessfully(candidateApi.candidates)
    return response.data
  }

  static async findById (id) {
    console.log('candidateApi findById id', id)
    let target = {}
    for (let a of candidateApi.candidates) {
      if (a.id === id) {
        target = a
      }
    }
    const response = await mockApi.queryByIdSuccessfully(target)
    return response.data
  }

  static async del (id) {
    console.log('candidateApi del id', id)
    const response = await mockApi.operateSuccessfully()
    return response.data
  }
}